package org.huzhp.gateway.dynamic;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @Description:
 * @Author: huzp
 * @CreateDate: 2020/3/20 12:20
 * @Version: 1.0
 */
@ConfigurationProperties("spring.cloud.gateway.console")
public class ConsoleProperties {

    private String server;

    private Route route;

    private Rule rule;

    public String buildRoutePath() {
        return "http://" + this.server + this.route.getPath();
    }

    public String buildRulePath() {
        return "http://" + this.server + this.rule.getPath();
    }

    public static class Route {
        private boolean enable;

        private String path = "/api/routes";

        public boolean isEnable() {
            return enable;
        }

        public void setEnable(boolean enable) {
            this.enable = enable;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }


    }

    public static class Rule {
        private boolean enable;
        private String path = "/api/rules";

        public boolean isEnable() {
            return enable;
        }

        public void setEnable(boolean enable) {
            this.enable = enable;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }
    }

    public String getServer() {
        return server;
    }

    public void setServer(String server) {
        this.server = server;
    }

    public Route getRoute() {
        return route;
    }

    public void setRoute(Route route) {
        this.route = route;
    }

    public Rule getRule() {
        return rule;
    }

    public void setRule(Rule rule) {
        this.rule = rule;
    }
}
